﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Media.Imaging;
using System.IO.IsolatedStorage;

namespace KOF.Views
{
    public partial class ReleaseStatus : PhoneApplicationPage
    {
        public ReleaseStatus()
        {
            InitializeComponent();
        }

        // Upcoming status =1 , Past status =0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {

            try
            { 
                // Past selected if status =0 else upcoming selected
                if ((App.Current as App).ReleaseStatusTemp == 0)
                {
                    imgUpcoming.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
                    imgPast.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
                }
                else
                {
                    imgUpcoming.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
                    imgPast.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        // on image Click Set Tick image for Upcoming
        private void img2_MouseEnter(object sender, MouseEventArgs e)
        {
            try
            {
            imgUpcoming.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
            imgPast.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
            (App.Current as App).ReleaseStatusTemp = 1;
           
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        // on image Click Set Tick image for Past
        private void img1_MouseEnter(object sender, MouseEventArgs e)
        {
            try
            {
            imgPast.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
            imgUpcoming.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
            (App.Current as App).ReleaseStatusTemp = 0;
            
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        // on Button Click Set Tick image for Upcoming
        private void btnUpcoming_Click(object sender, RoutedEventArgs e)
        {
            try
            {
            imgUpcoming.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
            imgPast.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
            (App.Current as App).ReleaseStatusTemp = 1;
            
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        // on Button Click Set Tick image for Past
        private void btnPast_Click(object sender, RoutedEventArgs e)
        {
            try
            {
            imgPast.Source = new BitmapImage(new Uri("../Images/ic_tick.png", UriKind.Relative));
            imgUpcoming.Source = new BitmapImage(new Uri("../Images/trans.png", UriKind.Relative));
            (App.Current as App).ReleaseStatusTemp = 0;
            
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        //Back Button Click Event
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.NavigationService.GoBack();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

    }
}